package com.yunhoo.govProcure.bean;

import com.yunhoo.govProcure.model.CateEditDetail;
import com.yunhoo.sys.db.util.IbatisTemplate;
import com.yunhoo.sys.util.common.CommonParam;
import com.yunhoo.sys.util.common.LoginParam;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.model.SelectItem;

@ManagedBean(name = "viewBean")
@ViewScoped
public class ViewBean {

    private List<Integer> yearli;//年度列表
    private List<SelectItem> deptli;//部门列表
    //
    private Integer iyear; 
    private String quality;//采购预算资金性质
    private String addSign;//0：新增 1：追加
    private String deptCode;//部门
    //
    private List<CateEditDetail> budgetViewList = null;//预算清单
    private List<CateEditDetail> planViewList = null;//计划清单

    public ViewBean() {
        init();
    }

    private void init() {
        yearli = CommonParam.yearListOfInteger();
        deptli = CommonParam.deptListOfSelect();
        iyear = LoginParam.getIyear();
        quality = "";
        addSign = "";
        deptCode = LoginParam.getDept().getCode();
    }

    public void queryBudgetli() {
        initBudgetList();
    }

    private void initBudgetList() {
        Map map = new HashMap();
        map.put("orgCode", LoginParam.getOrg().getCode());
        map.put("yearSys", iyear);
        map.put("yearQuery", iyear);
        map.put("quality", quality);
        map.put("addSign", addSign);
        map.put("deptCode", deptCode);
        budgetViewList = IbatisTemplate.queryForList("procureBudgetEdit.queryListBudgetDetailView", map);
    }

    public void queryPlanli() {
        initPlanList();
    }

    private void initPlanList() {
        Map map = new HashMap();
        map.put("orgCode", LoginParam.getOrg().getCode());
        map.put("yearSys", iyear);
        map.put("yearQuery", iyear);
        map.put("quality", quality);
        map.put("addSign", addSign);
        map.put("deptCode", deptCode);
        planViewList = IbatisTemplate.queryForList("procurePlanEdit.queryListPlanDetailView", map);
    }

    public List<Integer> getYearli() {
        return yearli;
    }

    public void setYearli(List<Integer> yearli) {
        this.yearli = yearli;
    }

    public List<SelectItem> getDeptli() {
        return deptli;
    }

    public void setDeptli(List<SelectItem> deptli) {
        this.deptli = deptli;
    }

    public Integer getIyear() {
        return iyear;
    }

    public void setIyear(Integer iyear) {
        this.iyear = iyear;
    }

    public String getQuality() {
        return quality;
    }

    public void setQuality(String quality) {
        this.quality = quality;
    }

    public String getAddSign() {
        return addSign;
    }

    public void setAddSign(String addSign) {
        this.addSign = addSign;
    }

    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    public List<CateEditDetail> getBudgetViewList() {
        return budgetViewList;
    }

    public void setBudgetViewList(List<CateEditDetail> budgetViewList) {
        this.budgetViewList = budgetViewList;
    }

    public List<CateEditDetail> getPlanViewList() {
        return planViewList;
    }

    public void setPlanViewList(List<CateEditDetail> planViewList) {
        this.planViewList = planViewList;
    }
}
